from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlmodel import SQLModel

# 设置数据库的URL，并创建数据库引擎
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://root:Zz2421567014@localhost:3306/witnova?charset=utf8mb4"
engine = create_engine(SQLALCHEMY_DATABASE_URL)

# 创建会话，并把当前引擎绑定给该对话
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine, expire_on_commit=True)

# 映射
Base = SQLModel